import App from './App'
import 'vant/lib/index.css';
import { TOKEN_KEY } from '@/enums/cacheEnum.js'
import { isAppH5 , getAppUserToken} from '@/utils/app.js'
// #ifndef VUE3
import Vue from 'vue'
import './uni.promisify.adaptor'
Vue.config.productionTip = false
App.mpType = 'app'
const app = new Vue({
  ...App
})
app.$mount()
// #endif

// #ifdef VUE3
import { createSSRApp } from 'vue'
export function createApp() {
  const app = createSSRApp(App)
  return {
    app
  }
}
// #endif
var params = new URL(location.href).searchParams;
let token = params.get('token')
let version = params.get('version')
// }
uni.setStorageSync(TOKEN_KEY,token)
version && uni.setStorageSync('API_VERSION',version)

if(isAppH5()) {
	getAppUserToken().then(res=> {
		uni.setStorageSync(TOKEN_KEY,res)
	}).catch(err => {
		
	})
	// const options =  getToken()
	// uni.setStorageSync(TOKEN_KEY,options.token)
}